   package com.javalong.affairs.base.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.View.OnClickListener;

import com.javalong.affairs.base.common.ISynCallback;
import com.javalong.affairs.base.common.ServiceLocator;
import com.javalong.affairs.base.common.UIHandler;

public class BaseFragment extends Fragment implements ISynCallback,OnClickListener {
	private int[] events;

	protected void registerEvent(int[] events) {
		this.events = events;
		UIHandler uiHandler = ServiceLocator.GetInstance().getInstance(
				UIHandler.class);
		if (uiHandler != null && events != null) {
			for (int i = 0; i < events.length; i++) {
				uiHandler.registerCallback(this, events[i]);
			}
		}
	}

	@Override
	public void OnSynCalled(int ulID, Bundle bundle) {
	}

	@Override
	public void onDestroyView() {
		super.onDestroyView();
		UIHandler uiHandler = ServiceLocator.GetInstance().getInstance(
				UIHandler.class);
		if (events != null) {
			for (int i = 0; i < events.length; i++) {
				uiHandler.unRegisterCallback(this, events[i]);
			}
		}
	}

	public void refresh() {
	}
	@Override
	public void onClick(View v) {
	}
}
